# load packages

pacman::p_load(tidyverse, lubridate)

### figure 2 (media coverage of violence in pools) ----

# load data
salience <- read_rds("data/newspaper_salience.rds")

# plot
ggplot(salience, aes(months, counts)) + 
    geom_rect(
        aes(
            xmin = as.Date(paste0(year(months), "-05-01")),
            xmax = as.Date(paste0(year(months), "-09-01")),
            ymin = -Inf,
            ymax = Inf
        ),
        inherit.aes = FALSE,
        alpha = 0.03
    ) +
    theme_minimal() +
    geom_line() +
    geom_point(shape = 21, fill = "white") +
    theme(axis.text.x = element_text(angle=45, hjust=1)) +
    scale_x_date(date_breaks = "5 months",
                 date_labels = "%Y-%m") +
    ylab('Number of Newspaper Articles') +
    xlab('Month') +
    theme(text = element_text(size = 16))

# clean
rm(list = ls())
